#-*-coding:UTF-8 -*-
'''
Created on 2013-6-4

@author: Administrator
'''
#格式化字符串
#%c
#%r
#%d
#%u
#%o
#%x
#%e
#%f
#%%
#格式化辅助相关
from types import IntType
from symbol import except_clause
from _pyio import UnsupportedOperation
'''
* 定义宽度或者小数点精度
- 用做左对齐
+ 在正数前面显示加号( + )
<sp> 在正数前面显示空格
# 在八进制数前面显示零('0')，在十六进制前面显示'0x'或者'0X'(取决于
用的是'x'还是'X')
0 显示的数字前面填充‘0’而不是默认的空格
% '%%'输出一个单一的'%'
(var) 映射变量(字典参数)
m.n m 是显示的最小总宽度,n 是小数点后的位数(如果可用的话)
'''
from string import Template
print ' '.join(('a', 'b', 'c'))
s = Template("There are ${howmany}, ${lang} Quotation Symbols")
print s.substitute(lang='java', howmany='2')
#原始字符串
print r'\t Hello worlod'
print '\t Hello worlod'

i = 3
if type(i) is IntType :
    print 'yes'
else:
    print 'no'
    
print min('abcdeaf')
for (i,n) in enumerate('abcdefghijklmnopqrstuvwxyz'):
    print '%s: %s' % (i + 1, n)
print zip(('abc'),('tt'))

print unichr(12345)
print u'hello world'

s = 'abc'
s = u'中国人'
ss = '中国人'
print s
print ss
print str(ss)

CODEC = "utf-8"
hello_out = u"Hello world\n"
bytes_out = hello_out.encode(CODEC)
print bytes_out

try:
    print sum(['a','b'])
except TypeError, e:
    pass
lists = []

#深度拷贝
person = ['name',['saving',100.00]]
hubby = person
from copy import deepcopy
wife = deepcopy(person)
hubby[0] = 'joe'
wife[0] = 'jane'
print hubby,wife
hubby[1][1] = 50.0
print hubby,wife